
import libnum
mm="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
c='HIVMURCQWQIWUHEV'

def decrypt(c1, a1, b):
    flag=""
    for i in range(len(c)):
        ch=c1[i]
        t=chr(a1*(ord(ch)-ord("A") -b) % 26+ord("A"))
        flag+=t
    # print(d)
    return flag

ff=[]
for i in range (2,27):
    for j in range(2,27):
        try:
            if libnum.gcd(i,j)==1 and i<j:
                ff1 = []
                i1 = libnum.invmod(i, 26)
                m1 = decrypt(c, i1, j)

                ff1.append(m1)
                ff1.append(i)
                ff1.append(j)

                ff.append(ff1)
        except:
            continue
for i in ff:
    print(i)